From e127ae595201d5aa07240b0ad45ac15ef9fead08 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 5 Oct 2005 16:54:09 +0100 Subject: [PATCH] Emulate guest reads of CR4, masking features that Xen does not export to guests. Signed-off-by: Keir Fraser --- xen/arch/x86/traps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e0f00d3920..44f902f505 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -895,6 +895,14 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) *reg = pagetable_get_paddr(v->arch.guest_table); break; + case 4: /* Read CR4 */ + /* + * Guests can read CR4 to see what features Xen has enabled. We + * therefore lie about PGE & PSE as they are unavailable to guests. + */ + *reg = read_cr4() & ~(X86_CR4_PGE|X86_CR4_PSE); + break; + default: goto fail; } -- 2.30.2